3.285 \(\int \frac{(a+\frac{b}{x})^n x^2}{c+d x} \, dx\)

Optimal. Leaf size=195 \[ \frac{\left (a+\frac{b}{x}\right )^{n+1} \left (2 a^2 c^2-2 a b c d n-b^2 d^2 (1-n) n\right ) \, _2F_1\left (1,n+1;n+2;\frac{b}{a x}+1\right )}{2 a^3 d^3 (n+1)}-\frac{x \left (a+\frac{b}{x}\right )^{n+1} (2 a c+b d (1-n))}{2 a^2 d^2}-\frac{c^3 \left (a+\frac{b}{x}\right )^{n+1} \, _2F_1\left (1,n+1;n+2;\frac{c \left (a+\frac{b}{x}\right )}{a c-b d}\right )}{d^3 (n+1) (a c-b d)}+\frac{x^2 \left (a+\frac{b}{x}\right )^{n+1}}{2 a d} \]

[Out]

-((2*a*c + b*d*(1 - n))*(a + b/x)^(1 + n)*x)/(2*a^2*d^2) + ((a + b/x)^(1 + n)*x^2)/(2*a*d) - (c^3*(a + b/x)^(1
 + n)*Hypergeometric2F1[1, 1 + n, 2 + n, (c*(a + b/x))/(a*c - b*d)])/(d^3*(a*c - b*d)*(1 + n)) + ((2*a^2*c^2 -
 2*a*b*c*d*n - b^2*d^2*(1 - n)*n)*(a + b/x)^(1 + n)*Hypergeometric2F1[1, 1 + n, 2 + n, 1 + b/(a*x)])/(2*a^3*d^
3*(1 + n))

________________________________________________________________________________________

Rubi [A]  time = 0.215586, antiderivative size = 195, normalized size of antiderivative = 1., number of steps used = 7, number of rules used = 7, integrand size = 20, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.35, Rules used = {514, 446, 103, 151, 156, 65, 68} \[ \frac{\left (a+\frac{b}{x}\right )^{n+1} \left (2 a^2 c^2-2 a b c d n-b^2 d^2 (1-n) n\right ) \, _2F_1\left (1,n+1;n+2;\frac{b}{a x}+1\right )}{2 a^3 d^3 (n+1)}-\frac{x \left (a+\frac{b}{x}\right )^{n+1} (2 a c+b d (1-n))}{2 a^2 d^2}-\frac{c^3 \left (a+\frac{b}{x}\right )^{n+1} \, _2F_1\left (1,n+1;n+2;\frac{c \left (a+\frac{b}{x}\right )}{a c-b d}\right )}{d^3 (n+1) (a c-b d)}+\frac{x^2 \left (a+\frac{b}{x}\right )^{n+1}}{2 a d} \]

Antiderivative was successfully verified.

[In]

Int[((a + b/x)^n*x^2)/(c + d*x),x]

[Out]

-((2*a*c + b*d*(1 - n))*(a + b/x)^(1 + n)*x)/(2*a^2*d^2) + ((a + b/x)^(1 + n)*x^2)/(2*a*d) - (c^3*(a + b/x)^(1
 + n)*Hypergeometric2F1[1, 1 + n, 2 + n, (c*(a + b/x))/(a*c - b*d)])/(d^3*(a*c - b*d)*(1 + n)) + ((2*a^2*c^2 -
 2*a*b*c*d*n - b^2*d^2*(1 - n)*n)*(a + b/x)^(1 + n)*Hypergeometric2F1[1, 1 + n, 2 + n, 1 + b/(a*x)])/(2*a^3*d^
3*(1 + n))

Rule 514

Int[(x_)^(m_.)*((c_) + (d_.)*(x_)^(mn_.))^(q_.)*((a_) + (b_.)*(x_)^(n_.))^(p_.), x_Symbol] :> Int[x^(m - n*q)*
(a + b*x^n)^p*(d + c*x^n)^q, x] /; FreeQ[{a, b, c, d, m, n, p}, x] && EqQ[mn, -n] && IntegerQ[q] && (PosQ[n] |
|  !IntegerQ[p])

Rule 446

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Dist[1/n, Subst[Int
[x^(Simplify[(m + 1)/n] - 1)*(a + b*x)^p*(c + d*x)^q, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p, q}, x] &&
 NeQ[b*c - a*d, 0] && IntegerQ[Simplify[(m + 1)/n]]

Rule 103

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Simp[(b*(a +
 b*x)^(m + 1)*(c + d*x)^(n + 1)*(e + f*x)^(p + 1))/((m + 1)*(b*c - a*d)*(b*e - a*f)), x] + Dist[1/((m + 1)*(b*
c - a*d)*(b*e - a*f)), Int[(a + b*x)^(m + 1)*(c + d*x)^n*(e + f*x)^p*Simp[a*d*f*(m + 1) - b*(d*e*(m + n + 2) +
 c*f*(m + p + 2)) - b*d*f*(m + n + p + 3)*x, x], x], x] /; FreeQ[{a, b, c, d, e, f, n, p}, x] && LtQ[m, -1] &&
 IntegerQ[m] && (IntegerQ[n] || IntegersQ[2*n, 2*p])

Rule 151

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_)*((e_.) + (f_.)*(x_))^(p_)*((g_.) + (h_.)*(x_)), x_Symb
ol] :> Simp[((b*g - a*h)*(a + b*x)^(m + 1)*(c + d*x)^(n + 1)*(e + f*x)^(p + 1))/((m + 1)*(b*c - a*d)*(b*e - a*
f)), x] + Dist[1/((m + 1)*(b*c - a*d)*(b*e - a*f)), Int[(a + b*x)^(m + 1)*(c + d*x)^n*(e + f*x)^p*Simp[(a*d*f*
g - b*(d*e + c*f)*g + b*c*e*h)*(m + 1) - (b*g - a*h)*(d*e*(n + 1) + c*f*(p + 1)) - d*f*(b*g - a*h)*(m + n + p
+ 3)*x, x], x], x] /; FreeQ[{a, b, c, d, e, f, g, h, n, p}, x] && LtQ[m, -1] && IntegerQ[m]

Rule 156

Int[(((e_.) + (f_.)*(x_))^(p_)*((g_.) + (h_.)*(x_)))/(((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))), x_Symbol] :>
 Dist[(b*g - a*h)/(b*c - a*d), Int[(e + f*x)^p/(a + b*x), x], x] - Dist[(d*g - c*h)/(b*c - a*d), Int[(e + f*x)
^p/(c + d*x), x], x] /; FreeQ[{a, b, c, d, e, f, g, h}, x]

Rule 65

Int[((b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[((c + d*x)^(n + 1)*Hypergeometric2F1[-m, n +
 1, n + 2, 1 + (d*x)/c])/(d*(n + 1)*(-(d/(b*c)))^m), x] /; FreeQ[{b, c, d, m, n}, x] &&  !IntegerQ[n] && (Inte
gerQ[m] || GtQ[-(d/(b*c)), 0])

Rule 68

Int[((a_) + (b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[((b*c - a*d)^n*(a + b*x)^(m + 1)*Hype
rgeometric2F1[-n, m + 1, m + 2, -((d*(a + b*x))/(b*c - a*d))])/(b^(n + 1)*(m + 1)), x] /; FreeQ[{a, b, c, d, m
}, x] && NeQ[b*c - a*d, 0] &&  !IntegerQ[m] && IntegerQ[n]

Rubi steps

\begin{align*} \int \frac{\left (a+\frac{b}{x}\right )^n x^2}{c+d x} \, dx &=\int \frac{\left (a+\frac{b}{x}\right )^n x}{d+\frac{c}{x}} \, dx\\ &=-\operatorname{Subst}\left (\int \frac{(a+b x)^n}{x^3 (d+c x)} \, dx,x,\frac{1}{x}\right )\\ &=\frac{\left (a+\frac{b}{x}\right )^{1+n} x^2}{2 a d}+\frac{\operatorname{Subst}\left (\int \frac{(a+b x)^n (2 a c+b d (1-n)+b c (1-n) x)}{x^2 (d+c x)} \, dx,x,\frac{1}{x}\right )}{2 a d}\\ &=-\frac{(2 a c+b d (1-n)) \left (a+\frac{b}{x}\right )^{1+n} x}{2 a^2 d^2}+\frac{\left (a+\frac{b}{x}\right )^{1+n} x^2}{2 a d}-\frac{\operatorname{Subst}\left (\int \frac{(a+b x)^n \left (2 a^2 c^2-2 a b c d n-b^2 d^2 (1-n) n-b c (2 a c+b d (1-n)) n x\right )}{x (d+c x)} \, dx,x,\frac{1}{x}\right )}{2 a^2 d^2}\\ &=-\frac{(2 a c+b d (1-n)) \left (a+\frac{b}{x}\right )^{1+n} x}{2 a^2 d^2}+\frac{\left (a+\frac{b}{x}\right )^{1+n} x^2}{2 a d}+\frac{c^3 \operatorname{Subst}\left (\int \frac{(a+b x)^n}{d+c x} \, dx,x,\frac{1}{x}\right )}{d^3}-\frac{\left (2 a^2 c^2-2 a b c d n-b^2 d^2 (1-n) n\right ) \operatorname{Subst}\left (\int \frac{(a+b x)^n}{x} \, dx,x,\frac{1}{x}\right )}{2 a^2 d^3}\\ &=-\frac{(2 a c+b d (1-n)) \left (a+\frac{b}{x}\right )^{1+n} x}{2 a^2 d^2}+\frac{\left (a+\frac{b}{x}\right )^{1+n} x^2}{2 a d}-\frac{c^3 \left (a+\frac{b}{x}\right )^{1+n} \, _2F_1\left (1,1+n;2+n;\frac{c \left (a+\frac{b}{x}\right )}{a c-b d}\right )}{d^3 (a c-b d) (1+n)}+\frac{\left (2 a^2 c^2-2 a b c d n-b^2 d^2 (1-n) n\right ) \left (a+\frac{b}{x}\right )^{1+n} \, _2F_1\left (1,1+n;2+n;1+\frac{b}{a x}\right )}{2 a^3 d^3 (1+n)}\\ \end{align*}

Mathematica [A]  time = 0.125946, size = 157, normalized size = 0.81 \[ \frac{(a x+b) \left (a+\frac{b}{x}\right )^n \left ((a c-b d) \left (\left (2 a^2 c^2-2 a b c d n+b^2 d^2 (n-1) n\right ) \, _2F_1\left (1,n+1;n+2;\frac{b}{a x}+1\right )+a d (n+1) x (a (d x-2 c)+b d (n-1))\right )-2 a^3 c^3 \, _2F_1\left (1,n+1;n+2;\frac{c \left (a+\frac{b}{x}\right )}{a c-b d}\right )\right )}{2 a^3 d^3 (n+1) x (a c-b d)} \]

Antiderivative was successfully verified.

[In]

Integrate[((a + b/x)^n*x^2)/(c + d*x),x]

[Out]

((a + b/x)^n*(b + a*x)*(-2*a^3*c^3*Hypergeometric2F1[1, 1 + n, 2 + n, (c*(a + b/x))/(a*c - b*d)] + (a*c - b*d)
*(a*d*(1 + n)*x*(b*d*(-1 + n) + a*(-2*c + d*x)) + (2*a^2*c^2 - 2*a*b*c*d*n + b^2*d^2*(-1 + n)*n)*Hypergeometri
c2F1[1, 1 + n, 2 + n, 1 + b/(a*x)])))/(2*a^3*d^3*(a*c - b*d)*(1 + n)*x)

________________________________________________________________________________________

Maple [F]  time = 0.497, size = 0, normalized size = 0. \begin{align*} \int{\frac{{x}^{2}}{dx+c} \left ( a+{\frac{b}{x}} \right ) ^{n}}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b/x)^n*x^2/(d*x+c),x)

[Out]

int((a+b/x)^n*x^2/(d*x+c),x)

________________________________________________________________________________________

Maxima [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{{\left (a + \frac{b}{x}\right )}^{n} x^{2}}{d x + c}\,{d x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b/x)^n*x^2/(d*x+c),x, algorithm="maxima")

[Out]

integrate((a + b/x)^n*x^2/(d*x + c), x)

________________________________________________________________________________________

Fricas [F]  time = 0., size = 0, normalized size = 0. \begin{align*}{\rm integral}\left (\frac{x^{2} \left (\frac{a x + b}{x}\right )^{n}}{d x + c}, x\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b/x)^n*x^2/(d*x+c),x, algorithm="fricas")

[Out]

integral(x^2*((a*x + b)/x)^n/(d*x + c), x)

________________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b/x)**n*x**2/(d*x+c),x)

[Out]

Timed out

________________________________________________________________________________________

Giac [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{{\left (a + \frac{b}{x}\right )}^{n} x^{2}}{d x + c}\,{d x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b/x)^n*x^2/(d*x+c),x, algorithm="giac")

[Out]

integrate((a + b/x)^n*x^2/(d*x + c), x)